package com.infore.airsupervise.bean;

import android.content.Context;
import android.content.SharedPreferences;

import com.alibaba.fastjson.JSON;
import com.infore.airsupervise.app.Constants;
import com.infore.airsupervise.app.MyApplication;

import java.util.List;

/**
 * 污染源实体类
 * <p>
 * 作者: dingxinlin
 * 创建日期: 2017/4/12 15:36
 */

public class PolluterE extends BaseEntity {

    /**
     * mn : mn20170307164416
     * lnt : 113.1524290938
     * address :
     * phone :
     * person :
     * grid : 顺德区
     * name : 杏坛
     * discrib :
     * id : 2
     * lat : 22.7882979883
     */

    private String mn;
    private String lnt;
    private String address;
    private String phone;
    private String person;
    private String grid;
    private String name;
    private String discrib;
    private String id;
    private String lat;

    public String getMn() {
        return mn;
    }

    public void setMn(String mn) {
        this.mn = mn;
    }

    public String getLnt() {
        return lnt;
    }

    public void setLnt(String lnt) {
        this.lnt = lnt;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPerson() {
        return person;
    }

    public void setPerson(String person) {
        this.person = person;
    }

    public String getGrid() {
        return grid;
    }

    public void setGrid(String grid) {
        this.grid = grid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDiscrib() {
        return discrib;
    }

    public void setDiscrib(String discrib) {
        this.discrib = discrib;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    /**
     * 保存污染源
     */
    public static void savePolluterEList(List<PolluterE> list){
        SharedPreferences sp=  MyApplication.getInstance().
                getSharedPreferences(Constants.SP_FILE_USER, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor =sp.edit();
        String str_list = JSON.toJSONString(list);
        editor.putString(Constants.SP_STATIONTREE_KEY,str_list).commit();
    }
    /**
     * 获取污染源
     */
    public static List<PolluterE> getPolluterEList(){
        SharedPreferences sp=  MyApplication.getInstance().getSharedPreferences(Constants.SP_FILE_USER,Context.MODE_PRIVATE);
        List<PolluterE> list = JSON.parseArray(sp.getString(Constants.SP_STATIONTREE_KEY,""),PolluterE.class);
        return list;
    }
}
